package org.example.utils.common;

import com.freewayso.image.combiner.ImageCombiner;
import com.freewayso.image.combiner.enums.OutputFormat;
import com.freewayso.image.combiner.enums.ZoomMode;

public class ImageUtil {

    //模板一：三个图片并排，中间留白
    public void show1(String url1, String url2, String url3, String back) throws Exception {
        ImageCombiner combiner = new ImageCombiner(back, OutputFormat.JPG);
        combiner.setBackgroundBlur(30);     //设置背景高斯模糊（毛玻璃效果）
//        combiner.setCanvasRoundCorner(100); //设置整图圆角（输出格式必须为PNG）

        combiner.addImageElement(url1, 0, 50, 1100, 400, ZoomMode.WidthHeight)
                .setHeight(350)
                .setCenter(true);
        combiner.addImageElement(url2,0,450,1100,800,ZoomMode.WidthHeight)
                .setHeight(350)
                .setCenter(true);
        combiner.addImageElement(url3,0,850,1100,1200,ZoomMode.WidthHeight)
                .setHeight(350)
                .setCenter(true);

        //执行图片合并
        combiner.combine();

        //保存文件
        combiner.save("d://url1.png");

    }
}
